package com.mall.user.service.impl;

import com.mall.entity.RolePermission;
import com.mall.user.mapper.RolePermissionMapper;
import com.mall.user.service.RolePermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class RolePermissionServiceImpl implements RolePermissionService {

    @Autowired
    private RolePermissionMapper rolePermissionMapper;

    /**
     * 给角色添加权限
     * @param rolePermission
     * @return
     */
    public int addPermission(RolePermission rolePermission) {
        rolePermission.setIsDeleted(0);
        rolePermission.setCreateTime(new Date());
        rolePermission.setUpdateTime(new Date());
        int result = rolePermissionMapper.insert(rolePermission);
        return result;
    }

}
